{include file="index/header"}
<link rel="stylesheet" href="__ADMIN__/wangEditor/css/wangEditor.min.css">
<script type="text/javascript" src="__ADMIN__/wangEditor/js/wangEditor.min.js"></script>
<body>
<div class="fly-panel fly-panel-user">
  <div class="tpt-admin">
    <fieldset class="layui-elem-field layui-field-title">
      <legend>修改帖子</legend>
    </fieldset>
    <form class="layui-form">
      <input type="hidden" name="id" value="{$Thread.id}">
      <div class="layui-form-item" style="width: 300px;">
        <label class="layui-form-label">所在版块</label>
        <div class="layui-input-block">
          <select name="fid">
    	    {volist name="ForumList" id="vo"}
            <option {if condition="$Thread['fid'] eq $vo['id']"}selected="selected"{/if} value="{$vo.id}">{$vo.name}</option>
          {/volist}
    	    </select>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
          <input type="text" name="title" value="{$Thread.title}" required lay-verify="required" placeholder="必填内容" autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-block">
          <textarea id="textarea" name="content" style="height:500px;width: 100%;">{$Thread.content}</textarea>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">隐藏内容</label>
        <div class="layui-input-block">
          <input type="text" name="secret" value="{$Thread.secret}" autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
    	    <button class="layui-btn" lay-submit="" lay-filter="thread_edit">立即提交</button>
          <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>
        </div>
      </div>
    </form>
  </div>
</div>
{include file="index_footer"}
<script type="text/javascript">
    var editor = new wangEditor('textarea');
  editor.config.uploadImgUrl = '{:url("thread/doUploadPic")}';
  editor.config.uploadImgFileName = 'FileName';
    editor.create();
</script>
<script type="text/javascript">
layui.use('form',function(){
  var form = layui.form()
  ,jq = layui.jquery;
  
  form.on('submit(thread_edit)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("thread/edit")}',param,function(data){
      if(data.code == 200){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.href = '{:url("thread/index")}';
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });

})
</script>
</body>
</html>